package api

import (
	"github.com/gin-gonic/gin"
	"zhibo/zhibo/api/hander"
	"zhibo/zhibo/pkg"
)

func LoadRand(r *gin.Engine) {

	r.Use(Cors())
	b := r.Group("/b")
	{

		b.POST("login", hander.Login)
		b.POST("create", hander.Create)
		b.GET("list", hander.List)
		b.GET("info", hander.Info)
		r.Use(pkg.JWTAuth("2210a"))
		b.GET("chat", hander.Chat)

	}

}
func Cors() gin.HandlerFunc {

	return func(c *gin.Context) {
		c.Header("Access-Control-Allow-Origin", "*")

	}
}
